package com.hmkj.core.mapper.account;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.po.account.AccountLog;
import com.hmkj.core.po.account.AccountLogSimulation;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 模拟账户资金记录相关Dao接口<br>
 *
 * @author eproo
 * @date 2018-07-05 09:50:54
 */
public interface AccountLogSimulationMapper extends GenericMapper<AccountLogSimulation, Integer> {

    /**
     * 前台模拟资金日志列表
     *
     * @param param
     * @return
     */
    @Select(" <script> SELECT t.* " +
            "FROM biz_account_log_simulation t WHERE t.user_id = #{userId}  AND t.del_flag = 1 " +
            "<if test=\"type != null and type == 1\"> AND t.type in (1,4,12) </if>" +
            "<if test=\"type != null and type == 2\"> AND t.type in (2,8,9,10,13)</if>" +
            "<if test=\"startTime != null and startTime != ''\"> AND t.`create_time` >= #{startTime} </if>" +
            "<if test=\"endTime != null and endTime != ''\"> AND t.`create_time` &lt;= #{endTime} </if>" +
            "ORDER BY t.create_time DESC,t.id DESC</script>")
    List<AccountLogSimulation> findListForAccountLogSimulationList(Map<String, Object> param);

    /**
     * 前台模拟资金日志列表
     *
     * @param param
     * @return
     */
    @Select(" <script> SELECT count(*) " +
            "FROM biz_account_log_simulation t WHERE t.user_id = #{userId}  AND t.del_flag = 1 " +
            "<if test=\"type != null and type == 1\"> AND t.`type` in (1,4,12) </if>" +
            "<if test=\"type != null and type == 2\"> AND t.`type` in (2,8,9,10,13)</if>" +
            "<if test=\"startTime != null and startTime != ''\"> AND t.`create_time` >= #{startTime} </if>" +
            "<if test=\"endTime != null and endTime != ''\"> AND t.`create_time` &lt;= #{endTime} </if>" +
            "</script>")
    Integer findCountForAccountLogSimulationList(Map<String, Object> param);

}
